/**********************************************
*  Namespace: AI
*  Classes:   SteeringFlee
*  Desc:      Updates positions using a Flee
*             algorithm in 2d or 3d cases
*  Author:    Vaios Kalpias-Ilias (C) 2008-2009
***********************************************/

#include "SteeringFlee.h"

namespace AI
{
	//---------------------------------------------
	/**
	* Ctor
	*/
	SteeringFlee::SteeringFlee()
	{
	}
	//---------------------------------------------
	/**
	* Dtor
	*/
	SteeringFlee::~SteeringFlee()
	{
	}
	//---------------------------------------------
	/**
	* Returns new kinematic data in 2d
	*/
	Steering2d SteeringFlee::GetSteering(const Kinematic2d& current,
									   const Kinematic2d& target)
	{
		Steering2d steering;
		// get the negative direction to the target
		steering.linear = current.position - target.position;
		// give full acceleration along this direction
		steering.linear.Normalize();
		steering.linear *= maxAcceleration;

		// output steering
		return steering;
	}

}
